/**
 * 
 */
package com.thon.commons.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;

/**
 * @file OrderNoGenerator.java
 * @author thon
 * @email thon.ju@gmail.com
 * @date Jul 6, 2013 11:27:37 AM
 * @description 生成订单编号
 */
public class OrderNoGenerator {
	
	public static String generator(String prefix) {
		Date date = new Date();
		SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmmss");
		String dateString = sdf.format(date);
		String randomString = RandomStringUtils.randomNumeric(2);
		
		return prefix + dateString + randomString;
	}
	
	public static String randomnum(int i) {
		Date date = new Date();
		SimpleDateFormat sdf = new SimpleDateFormat("MMddHHmmss");
		String dateString = sdf.format(date);
		return  dateString + StringUtils.leftPad(i+"", 4, "0");
	}
}
